#include <lvgl.h>
#include <WiFi.h>
#include <Preferences.h>
#include "../../common.h"

extern const lv_img_dsc_t wlan_icon;

class Wlan
{
  private:
  lv_obj_t *label_scr, *label_msg, *label_sym, *label_ssid;
  lv_style_t font_style;
  Preferences save_cfg;
  String ssid, password;
  Event event = NOEVENT;
  int timecal;
  bool is_connected = false, is_connecting = false;

  void init_gui();
  void show_msg(String, String, String);
  void try_connect();
  
  public:
  Wlan(bool auto_connect=false);
  ~Wlan();
  Event main_process(Action);
};
